import axios from 'axios'
import url from './url'
import qs from 'qs'

axios.defaults.withCredentials = true

//list
export const getDaifu = params =>{
	return axios.get(url.daifu,{params:params})
}

//savedaifu
export const saveDaifu = params =>{
	return axios.post(url.saveDaifu,createPostParams(params))
}

//index
export const getIndex = params =>{
	return axios.get(url.index,{params:params})
}

//获取用户列表
export const getUserList = params =>{
	return axios.get(url.userList,{params:params})
}

//修改用户
export const reviseUser = params =>{
	return axios.post(url.reviseUser,createPostParams(params))
}

//修改用户mima
export const revisePwd = params =>{
	return axios.post(url.revisePwd,createPostParams(params))
}


//balance
export const getBalance = params =>{
	return axios.get(url.balance,{params:params})
}

//	绑定商户
export const bindBusiness = params =>{
	return axios.post(url.business,createPostParams(params))
}

//查询当前绑定商户情况
export const askBusiness = params =>{
	return axios.get(url.askBusiness+params)
}

//充值金额
export const postRecharge = params =>{
	return axios.post(url.recharge,createPostParams(params))
}

//启用
export const getStart = params =>{
	return axios.get(url.start+params)
}

//停用
export const getStop = params =>{
	return axios.get(url.stop+params)
}

//获取用户信息
export const getUserInfo = params =>{
	return axios.get(url.userInfo,{params:params})
}

//保存商户
export const saveBusiness = params =>{
	return axios.post(url.saveBusiness,createPostParams(params))
}

//获取商户列表
export const getBusinessList = (params,data) =>{
	return axios.get(url.BusinessList+params,{params:data})
}

//BusinessStop
export const getBusinessStop = params =>{
	return axios.get(url.businessStop+params)
}

//BusinessStart
export const getBusinessStart = params =>{
	return axios.get(url.businessStart+params)
}

//保存商户组
export const saveBusinessGroup = params =>{
	return axios.post(url.businessGroup,createPostParams(params))
}

//商户组列表
export const getBusinessGroupList = params =>{
	return axios.get(url.businessGroupList+params)
}

//商户组start
export const getBusinessGroupStart = params =>{
	return axios.get(url.businessGroupStart+params)
}

//商户组stop
export const getBusinessGroupStop = params =>{
	return axios.get(url.businessGroupStop+params)
}

//权限列表
export const getPermissionList = params =>{
	return axios.get(url.permissionList,{params:params})
}

//保存权限
export const savePermission = params =>{
	return axios.post(url.savePermission,createPostParams(params))
}

//删除权限
export const deletePermission = params =>{
	return axios.delete(url.deletePermission+params)
}

//用户分页查询
export const getUserPage = params =>{
	return axios.get(url.userPage,{params:params})
}

//保存用户
export const saveUser = params =>{
	return axios.post(url.saveUser,createPostParams(params))
}

//用户角色修改
export const saveUserRole = params =>{
	return axios.post(url.saveUserRole,createPostParams(params))
}

//查看下级的角色列表
export const getSeeRoleList = params =>{
	return axios.get(url.seeRoleList+params)
}

//删除用户
export const deleteUser = params =>{
	return axios.delete(url.deleteUser+params)
}

//查询用户
export const getAskUser = params =>{
	return axios.get(url.askUser+params)
}

//登录
export const login = params =>{
	return axios.post(url.login,createPostParams(params))
}

//登录成功
export const loginSuccess = params =>{
	return axios.post(url.loginSuccess,createPostParams(params))
}

//退出登录
export const getLogout = params =>{
	return axios.get(url.logout)
}

//获取用户导航栏设置
export const getNavigation = params =>{
	return axios.get(url.getNavigation,{params:params})
}

//获取用户信息
export const getUserInfoAuth = params =>{
	return axios.get(url.getUserInfoAuth,{params:params})
}

//菜单列表
export const getMenuList = params =>{
	return axios.get(url.menuList,{params:params})
}

//保存菜单
export const saveMenu = params =>{
	return axios.post(url.saveMenu,createPostParams(params))
}

//权限编辑
export const permissionPost = params =>{
	return axios.post(url.permissionPost,createPostParams(params))
}

//菜单权限列表
export const getMenuPermissionList = params =>{
	return axios.get(url.menuPermissionList+params)
}
//删除菜单
export const deleteMenu = params =>{
	return axios.delete(url.deleteMenu+params)
}
//菜单详情
export const getMenuDetail = params =>{
	return axios.get(url.menuDetail+params)
}

//菜单列表roleId
export const getMenuRoleList = params =>{
	return axios.get(url.menuRoleList+params)
}

//删除角色
export const deleteRole = params =>{
	return axios.delete(url.deleteRole+params)
}

//角色详情
export const getRoleDetail = params =>{
	return axios.post(url.roleDetail+params)
}

//资源查询列表
export const getResourceList = params =>{
	return axios.get(url.resourceList,{params:params})
}

//保存资源
export const saveResource = params =>{
	return axios.post(url.saveResource,createPostParams(params))
}

//权限编辑
export const aditorPermission = params =>{
	return axios.post(url.aditorPermission,createPostParams(params))
}

//获取资源权限列表
export const getResourcePermissionList = params =>{
	return axios.get(url.resourcePermissionList+params)
}

//删除资源
export const deleteResource = params =>{
	return axios.delete(url.deleteResource+params)
}

//通道列表
export const getChannelList = params =>{
	return axios.get(url.channelList,{params:params})
}
//保存通道
export const saveChannel = params =>{
	return axios.post(url.saveChannel,createPostParams(params))
}
//通道start
export const getChannelStart = params =>{
	return axios.get(url.channelStart+params)
}
//通道stop
export const getChannelStop = params =>{
	return axios.get(url.channelStop+params)
}

//保存金额转换
export const saveMoneyMap = params =>{
	return axios.post(url.saveMoneyMap,createPostParams(params))
}
//金额转换列表
export const getMoneyMapList = params =>{
	return axios.get(url.moneyMapList+params)
}
//删除
export const deleteMoneyMap = params =>{
	return axios.delete(url.deleteMoneyMap+params)
}

//获取用户提现列表
export const getCashList = params =>{
	return axios.get(url.getCashList,{params:params})
}
//提现申请
export const requireCash = params =>{
	return axios.post(url.requireCash,createPostParams(params))
}
//获取所有提现列表
export const getAllCashList = params =>{
	return axios.get(url.getAllCashList,{params:params})
}

//查询用户订单
export const getOrderList = params =>{
	return axios.get(url.getOrderList,{params:params})
}


//查询所有订单
export const getAllOrderList = params =>{
	return axios.get(url.getAllOrderList,{params:params})
}


//获取客户首页信息

export const getIndexInfo = params =>{
	return axios.get(url.index,{params:params})
}

//历史登录
export const getLoginLog = params =>{
	return axios.get(url.loginLog,{params:params})
}

//历史登录last
export const getLoginLogLast = params =>{
	return axios.get(url.loginLogLast,{params:params})
}

//绑定银行卡
export const changeCard = params =>{
	return axios.post(url.changeCard,createPostParams(params))
}

//验证绑定邮箱验证码
export const checkCode = params =>{
	return axios.post(url.checkCode,createPostParams(params))
}

//传用户名
export const checkCodeNoPwd = params =>{
	return axios.post(url.checkCodeNoPwd,createPostParams(params))
}

//绑定邮箱
export const sendBindEmail = params =>{
	return axios.post(url.sendBindEmail,createPostParams(params))
}

//验证
export const sendForgetEmail = params =>{
	return axios.post(url.sendForgetEmail,createPostParams(params))
}
//获取首页的公共
export const getAllMes = params =>{
	return axios.get(url.getAllMes,{params:params})
}
//
export const getMesId = params =>{
	return axios.get(url.getMesId+params)
}
//验证邮箱是否存在
export const getQueryEmail = params =>{
  return axios.get(url.queryEmail,{params:params})
}

//实名认证
export const postRealName = params =>{
  return axios.post(url.realName,createPostParams(params))
}

//是否通过审核

export const checkStatus = params =>{
  return axios.get(url.checkStatus,{params:params})
}

//
export const getCountList = params =>{
  return axios.get(url.count,{params:params})
}

//
export const getchannels = params =>{
  return axios.get(url.channels,{params:params})
}









function createPostParams (obj) {
  return qs.stringify(obj, { indices: false })
}
